<template>
    <div>
      <el-card class="box-card">
        <el-row>
          <el-col :span="11">
            可开发票总金额{{}}
          </el-col>

        </el-row>

        <el-form :model="forms" ref="forms" label-width="80px">
          <el-form-item label="发票抬头" >
            <el-input v-model="forms.invoiceTitle" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="税号">
            <el-input v-model="forms.invoiceNum" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="发票类型">
            <el-select v-model="forms.invoiceType" >
              <el-option label="普通发票"   :value="1"></el-option>
              <el-option label="增值税发票"   :value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="税率">
            <el-input v-model="forms.taxRate" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="开票金额">
            <el-input v-model="forms.amount" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="发票内容">
            <el-input type="textarea" v-model="forms.content"  style="width: 300px;"></el-input>
          </el-form-item>
          <el-form-item label="收件人" >
            <el-input v-model="forms.receiver" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="联系电话" >
            <el-input v-model="forms.tel" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="收件地址" >
            <el-input v-model="forms.revAddress" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="物流公司" >
            <el-input v-model="forms.logisticsCym" style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item label="快递单号">
            <el-input v-model="forms.code"  style="width: 200px;"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">保存</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>


      </el-card>
    </div>
</template>

<script>
    export default {
        name: "updateReceipt",
      data(){
          return{
            forms:{tel:""}
          }
      },
      methods:{
        find(id){
          this.$http.get("invoice/find/"+id).then((res)=>{
            this.forms=res.data.result;
          })
        },
        //保存发票
        onSubmit:function () {

          this.$http.post("/invoice/save",this.forms).then((res)=>{
            if(res.data.success){
              alert(res.data.message);
            }else{
              alert(res.data.message);
            }
          });
          this.$router.push("invoiceList");

        }
      },
      mounted() {
          var id=this.$route.query.id
        this.find(id);
      }
    }
</script>

<style scoped>

</style>
